package cn.wenhe9.yygh.common.exception;

import cn.wenhe9.yygh.common.result.ResultResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author DuJinliang
 * 2022/2/11
 */
@RestControllerAdvice
public class GlobalExceptionHandler{
    @ExceptionHandler(Exception.class)
    public ResultResponse error(Exception e){
        e.printStackTrace();
        return ResultResponse.fail();
    }

    @ExceptionHandler(YyghException.class)
    public ResultResponse error(YyghException e){
        e.printStackTrace();
        return ResultResponse.fail();
    }
}
